home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / gdb / gdb.info-3 < prev    next >
Text File  |  1992-09-11  |  49KB  |  1,307 lines

  1. Info file gdb.info, produced by Makeinfo, -*- Text -*- from input
  2. file gdb-all.texi.
  3.  
  4.    This file documents the GNU debugger GDB.
  5.  
  6.    Copyright (C) 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
  7.  
  8.    Permission is granted to make and distribute verbatim copies of
  9. this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.  
  13.    Permission is granted to copy and distribute modified versions of
  14. this
  15. manual under the conditions for verbatim copying, provided also that
  16. the section entitled "GNU General Public License" is included
  17. exactly as in the original, and provided that the entire resulting
  18. derived work is distributed under the terms of a permission notice
  19. identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for
  23. modified versions, except that the section entitled "GNU General
  24. Public License" may be included in a translation approved by the
  25. Free Software Foundation instead of in the original English.
  26.  
  27. 
  28. File: gdb.info,  Node: List,  Next: Search,  Prev: Source,  Up: Source
  29.  
  30. Printing Source Lines
  31. =====================
  32.  
  33.    To print lines from a source file, use the `list' command
  34. (abbreviated `l').  There are several ways to specify what part of
  35. the file you want to print.
  36.  
  37.    Here are the forms of the `list' command most commonly used:
  38.  
  39. `list LINENUM'
  40.      Print lines centered around line number LINENUM in the current
  41.      source file.
  42.  
  43. `list FUNCTION'
  44.      Print lines centered around the beginning of function FUNCTION.
  45.  
  46. `list'
  47.      Print more lines.  If the last lines printed were printed with a
  48.      `list' command, this prints lines following the last lines
  49.      printed; however, if the last line printed was a solitary line
  50.      printed as part of displaying a stack frame (*note Stack::.),
  51.      this prints lines centered around that line.
  52.  
  53. `list -'
  54.      Print lines just before the lines last printed.
  55.  
  56.    By default, GDB prints ten source lines with any of these forms of
  57. the `list' command.  You can change this using `set listsize':
  58.  
  59. `set listsize COUNT'
  60.      Make the `list' command display COUNT source lines (unless the
  61.      `list' argument explicitly specifies some other number).
  62.  
  63. `show listsize'
  64.      Display the number of lines that `list' will currently display
  65.      by default.
  66.  
  67.    Repeating a `list' command with RET discards the argument, so it
  68. is equivalent to typing just `list'.  This is more useful than
  69. listing the same lines again.  An exception is made for an argument
  70. of
  71. `-'; that argument is preserved in repetition so that each
  72. repetition moves up in the source file.
  73.  
  74.    In general, the `list' command expects you to supply zero, one or
  75. two "linespecs".  Linespecs specify source lines; there are several
  76. ways of writing them but the effect is always to specify some source
  77. line.  Here is a complete description of the possible arguments for
  78. `list':
  79.  
  80. `list LINESPEC'
  81.      Print lines centered around the line specified by LINESPEC.
  82.  
  83. `list FIRST,LAST'
  84.      Print lines from FIRST to LAST.  Both arguments are linespecs.
  85.  
  86. `list ,LAST'
  87.      Print lines ending with LAST.
  88.  
  89. `list FIRST,'
  90.      Print lines starting with FIRST.
  91.  
  92. `list +'
  93.      Print lines just after the lines last printed.
  94.  
  95. `list -'
  96.      Print lines just before the lines last printed.
  97.  
  98. `list'
  99.      As described in the preceding table.
  100.  
  101.    Here are the ways of specifying a single source line--all the
  102. kinds of linespec.
  103.  
  104. `NUMBER'
  105.      Specifies line NUMBER of the current source file.  When a `list'
  106.      command has two linespecs, this refers to the same source file
  107.      as the first linespec.
  108.  
  109. `+OFFSET'
  110.      Specifies the line OFFSET lines after the last line printed. 
  111.      When used as the second linespec in a `list' command that has
  112.      two, this specifies the line OFFSET lines down from the first
  113.      linespec.
  114.  
  115. `-OFFSET'
  116.      Specifies the line OFFSET lines before the last line printed.
  117.  
  118. `FILENAME:NUMBER'
  119.      Specifies line NUMBER in the source file FILENAME.
  120.  
  121. `FUNCTION'
  122.      Specifies the line of the open-brace that begins the body of the
  123.      function FUNCTION.
  124.  
  125. `FILENAME:FUNCTION'
  126.      Specifies the line of the open-brace that begins the body of the
  127.      function FUNCTION in the file FILENAME.  You only need the file
  128.      name with a function name to avoid ambiguity when there are
  129.      identically named functions in different source files.
  130.  
  131. `*ADDRESS'
  132.      Specifies the line containing the program address ADDRESS. 
  133.      ADDRESS may be any expression.
  134.  
  135. 
  136. File: gdb.info,  Node: Search,  Next: Source Path,  Prev: List,  Up: Source
  137.  
  138. Searching Source Files
  139. ======================
  140.  
  141.    There are two commands for searching through the current source
  142. file for a regular expression.
  143.  
  144. `forward-search REGEXP'
  145. `search REGEXP'
  146.      The command `forward-search REGEXP' checks each line, starting
  147.      with the one following the last line listed, for a match for
  148.      REGEXP.  It lists the line that is found.  You can abbreviate
  149.      the command name as `fo'.  The synonym `search REGEXP' is also
  150.      supported.
  151.  
  152. `reverse-search REGEXP'
  153.      The command `reverse-search REGEXP' checks each line, starting
  154.      with the one before the last line listed and going backward,
  155.      for a match for REGEXP.  It lists the line that is found.  You
  156.      can abbreviate this command as `rev'.
  157.  
  158. 
  159. File: gdb.info,  Node: Source Path,  Next: Machine Code,  Prev: Search,  Up: Source
  160.  
  161. Specifying Source Directories
  162. =============================
  163.  
  164.    Executable programs sometimes do not record the directories of the
  165. source files from which they were compiled, just the names.  Even
  166. when they do, the directories could be moved between the compilation
  167. and your debugging session.  GDB has a list of directories to search
  168. for source files; this is called the "source path".  Each time GDB
  169. wants a source file, it tries all the directories in the list, in
  170. the order they are present in the list, until it finds a file with
  171. the desired name.  Note that the executable search path is *not*
  172. used for this purpose.  Neither is the current working directory,
  173. unless it happens to be in the source path.
  174.  
  175.    If GDB can't find a source file in the source path, and the object
  176. program records a directory, GDB tries that directory too.  If the
  177. source path is empty, and there is no record of the compilation
  178. directory, GDB will, as a last resort, look in the current directory.
  179.  
  180.    Whenever you reset or rearrange the source path, GDB will clear
  181. out any information it has cached about where source files are
  182. found, where each line is in the file, etc.
  183.  
  184.    When you start GDB, its source path is empty.  To add other
  185. directories, use the `directory' command.
  186.  
  187. `directory DIRNAME ...'
  188.      Add directory DIRNAME to the front of the source path.  Several
  189.      directory names may be given to this command, separated by `:'
  190.      or whitespace.  You may specify a directory that is already in
  191.      the source path; this moves it forward, so it will be searched
  192.      sooner.
  193.  
  194.      You can use the string `$cdir' to refer to the compilation
  195.      directory (if one is recorded), and `$cwd' to refer to the
  196.      current working directory.  `$cwd' is not the same as `.'--the
  197.      former tracks the current working directory as it changes
  198.      during your GDB session, while the latter is immediately
  199.      expanded to the current directory at the time you add an entry
  200.      to the source path.
  201.  
  202. `directory'
  203.      Reset the source path to empty again.  This requires confirmation.
  204.  
  205. `show directories'
  206.      Print the source path: show which directories it contains.
  207.  
  208.    If your source path is cluttered with directories that are no
  209. longer
  210. of interest, GDB may sometimes cause confusion by finding the wrong
  211. versions of source.  You can correct the situation as follows:
  212.  
  213.   1. Use `directory' with no argument to reset the source path to
  214.      empty.
  215.  
  216.   2. Use `directory' with suitable arguments to reinstall the
  217.      directories you want in the source path.  You can add all the
  218.      directories in one command.
  219.  
  220. 
  221. File: gdb.info,  Node: Machine Code,  Prev: Source Path,  Up: Source
  222.  
  223. Source and Machine Code
  224. =======================
  225.  
  226.    You can use the command `info line' to map source lines to program
  227. addresses
  228. (and viceversa), and the command `disassemble' to display a range of
  229. addresses as machine instructions.
  230.  
  231. `info line LINESPEC'
  232.      Print the starting and ending addresses of the compiled code for
  233.      source line LINESPEC.  You can specify source lines in any of
  234.      the ways understood by the `list' command (*note List::.).
  235.  
  236.    For example, we can use `info line' to inquire on where the object
  237. code for the first line of function `m4_changequote' lies:
  238.  
  239.      (gdb) info line m4_changecom
  240.      Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350.
  241.  
  242. We can also inquire (using `*ADDR' as the form for LINESPEC) what
  243. source line covers a particular address:
  244.  
  245.      (gdb) info line *0x63ff
  246.      Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404.
  247.  
  248.    After `info line', the default address for the `x' command is
  249. changed to the starting address of the line, so that `x/i' is
  250. sufficient to begin examining the machine code (*note Memory::.). 
  251. Also, this address is saved as the value of the convenience variable
  252. `$_' (*note Convenience Vars::.).
  253.  
  254. `disassemble'
  255.      This specialized command is provided to dump a range of memory
  256.      as machine instructions.  The default memory range is the
  257.      function surrounding the program counter of the selected frame.
  258.      A single argument to this command is a program counter value;
  259.      the function surrounding this value will be dumped.  Two
  260.      arguments (separated by one or more spaces) specify a range of
  261.      addresses (first inclusive, second exclusive) to be dumped.
  262.  
  263.    We can use `disassemble' to inspect the object code range shown in
  264. the last `info line' example:
  265.  
  266.      (gdb) disas 0x63e4 0x6404
  267.      Dump of assembler code from 0x63e4 to 0x6404:
  268.      0x63e4 builtin_init+5340:     ble 0x63f8 builtin_init+5360
  269.      0x63e8 builtin_init+5344:     sethi %hi(0x4c00), %o0
  270.      0x63ec builtin_init+5348:     ld [%i1+4], %o0
  271.      0x63f0 builtin_init+5352:     b 0x63fc builtin_init+5364
  272.      0x63f4 builtin_init+5356:     ld [%o0+4], %o0
  273.      0x63f8 builtin_init+5360:     or %o0, 0x1a4, %o0
  274.      0x63fc builtin_init+5364:     call 0x9288 path_search
  275.      0x6400 builtin_init+5368:     nop
  276.      End of assembler dump.
  277.      (gdb)
  278.  
  279. 
  280. File: gdb.info,  Node: Data,  Next: Languages,  Prev: Source,  Up: Top
  281.  
  282. Examining Data
  283. **************
  284.  
  285.    The usual way to examine data in your program is with the `print'
  286. command (abbreviated `p'), or its synonym `inspect'.  It evaluates
  287. and prints the value of an expression of the language your program
  288. is written in (*note Languages::.).
  289.  
  290. `print EXP'
  291. `print /F EXP'
  292.      EXP is an expression (in the source language).  By default the
  293.      value of EXP is printed in a format appropriate to its data
  294.      type; you can choose a different format by specifying `/F',
  295.      where F is a letter specifying the format; *note Output
  296.      formats::..
  297.  
  298. `print'
  299. `print /F'
  300.      If you omit EXP, GDB displays the last value again (from the
  301.      "value history"; *note Value History::.).  This allows you to
  302.      conveniently inspect the same value in an alternative format.
  303.  
  304.    A more low-level way of examining data is with the `x' command. 
  305. It examines data in memory at a specified address and prints it in a
  306. specified format.  *Note Memory::.
  307.  
  308.    If you're interested in information about types, or about how the
  309. fields of a struct or class are declared, use the `ptype EXP'
  310. command rather than `print'. *Note Symbols::.
  311.  
  312. * Menu:
  313.  
  314. * Expressions::                 Expressions
  315. * Variables::                   Program Variables
  316. * Arrays::                      Artificial Arrays
  317. * Output formats::              Output formats
  318. * Memory::                      Examining Memory
  319. * Auto Display::                Automatic Display
  320. * Print Settings::              Print Settings
  321. * Value History::               Value History
  322. * Convenience Vars::            Convenience Variables
  323. * Registers::                   Registers
  324. * Floating Point Hardware::     Floating Point Hardware
  325.  
  326. 
  327. File: gdb.info,  Node: Expressions,  Next: Variables,  Prev: Data,  Up: Data
  328.  
  329. Expressions
  330. ===========
  331.  
  332.    `print' and many other GDB commands accept an expression and
  333. compute its value.  Any kind of constant, variable or operator
  334. defined by the programming language you are using is legal in an
  335. expression in GDB.  This includes conditional expressions, function
  336. calls, casts and string constants.  It unfortunately does not
  337. include symbols defined by preprocessor `#define' commands.
  338.  
  339.    Because C is so widespread, most of the expressions shown in
  340. examples in this manual are in C.  *Note Using GDB with Different
  341. Languages: Languages, for information on how to use expressions in
  342. other languages.
  343.  
  344.    In this section, we discuss operators that you can use in GDB
  345. expressions regardless of your programming language.
  346.  
  347.    Casts are supported in all languages, not just in C, because it is
  348. so useful to cast a number into a pointer so as to examine a
  349. structure at that address in memory.
  350.  
  351.    GDB supports these operators in addition to those of programming
  352. languages:
  353.  
  354. `@'
  355.      `@' is a binary operator for treating parts of memory as arrays.
  356.      *Note Arrays::, for more information.
  357.  
  358. `::'
  359.      `::' allows you to specify a variable in terms of the file or
  360.      function where it is defined.  *Note Variables::.
  361.  
  362. `{TYPE} ADDR'
  363.      Refers to an object of type TYPE stored at address ADDR in
  364.      memory.  ADDR may be any expression whose value is an integer
  365.      or pointer (but parentheses are required around binary
  366.      operators, just as in a cast).  This construct is allowed
  367.      regardless of what kind of data is normally supposed to reside
  368.      at ADDR.
  369.  
  370. 
  371. File: gdb.info,  Node: Variables,  Next: Arrays,  Prev: Expressions,  Up: Data
  372.  
  373. Program Variables
  374. =================
  375.  
  376.    The most common kind of expression to use is the name of a
  377. variable in your program.
  378.  
  379.    Variables in expressions are understood in the selected stack
  380. frame (*note Selection::.); they must either be global (or static)
  381. or be visible according to the scope rules of the programming
  382. language from the point of execution in that frame.  This means that
  383. in the function
  384.  
  385.      foo (a)
  386.           int a;
  387.      {
  388.        bar (a);
  389.        {
  390.          int b = test ();
  391.          bar (b);
  392.        }
  393.      }
  394.  
  395. the variable `a' is usable whenever the program is executing within
  396. the function `foo', but the variable `b' is visible only while the
  397. program is executing inside the block in which `b' is declared.
  398.  
  399.    There is an exception: you can refer to a variable or function
  400. whose scope is a single source file even if the current execution
  401. point is not in this file.  But it is possible to have more than one
  402. such variable or function with the same name (in different source
  403. files).  If that happens, referring to that name has unpredictable
  404. effects.  If you wish, you can specify a variable in a particular
  405. file, using the colon-colon notation:
  406.  
  407.      FILE::VARIABLE
  408.  
  409. Here FILE is the name of the source file whose variable you want.
  410.  
  411.    This use of `::' is very rarely in conflict with the very similar
  412. use of the same notation in C++.  GDB also supports use of the C++
  413. scope resolution operator in GDB expressions.
  414.  
  415.      *Warning:* Occasionally, a local variable may appear to have the
  416.      wrong value at certain points in a function--just after entry
  417.      to the function, and just before exit.  You may see this
  418.      problem when you're stepping by machine instructions.  This is
  419.      because on most machines, it takes more than one instruction to
  420.      set up a stack frame (including local variable definitions); if
  421.      you're stepping by machine instructions, variables may appear
  422.      to have the wrong values until the stack frame is completely
  423.     
  424.      built.  On function exit, it usually also takes more than one
  425.      machine instruction to destroy a stack frame; after you begin
  426.      stepping through that group of instructions, local variable
  427.      definitions may be gone.
  428.  
  429. 
  430. File: gdb.info,  Node: Arrays,  Next: Output formats,  Prev: Variables,  Up: Data
  431.  
  432. Artificial Arrays
  433. =================
  434.  
  435.    It is often useful to print out several successive objects of the
  436. same type in memory; a section of an array, or an array of
  437. dynamically determined size for which only a pointer exists in the
  438. program.
  439.  
  440.    This can be done by constructing an "artificial array" with the
  441. binary operator `@'.  The left operand of `@' should be the first
  442. element of the desired array, as an individual object.  The right
  443. operand
  444. should be the desired length of the array.  The result is an array
  445. value whose elements are all of the type of the left argument.  The
  446. first element is actually the left argument; the second element
  447. comes from bytes of memory immediately following those that hold the
  448. first element, and so on.  Here is an example.  If a program says
  449.  
  450.      int *array = (int *) malloc (len * sizeof (int));
  451.  
  452. you can print the contents of `array' with
  453.  
  454.      p *array@len
  455.  
  456.    The left operand of `@' must reside in memory.  Array values made
  457. with `@' in this way behave just like other arrays in terms of
  458. subscripting, and are coerced to pointers when used in expressions. 
  459. Artificial arrays most often appear in expressions via the value
  460. history (*note Value History::.), after printing one out.)
  461.  
  462.    Sometimes the artificial array mechanism isn't quite enough; in
  463. moderately complex data structures, the elements of interest may not
  464. actually be adjacent--for example, if you're interested in the
  465. values of pointers in an array.  One useful work-around in this
  466. situation is to use a convenience variable (*note Convenience
  467. Vars::.) as a counter in an expression that prints the first
  468. interesting value, and then repeat that expression via RET.  For
  469. instance, suppose you have an array `dtab' of pointers to
  470. structures, and you're interested in the values of a field `fv' in
  471. each structure.  Here's an example of what you might type:
  472.  
  473.      set $i = 0
  474.      p dtab[$i++]->fv
  475.      RET
  476.      RET
  477.      ...
  478.  
  479. 
  480. File: gdb.info,  Node: Output formats,  Next: Memory,  Prev: Arrays,  Up: Data
  481.  
  482. Output formats
  483. ==============
  484.  
  485.    By default, GDB prints a value according to its data type. 
  486. Sometimes this is not what you want.  For example, you might want to
  487. print a number in hex, or a pointer in decimal.  Or you might want
  488. to view data in memory at a certain address as a character string or
  489. as an instruction.  To do these things, specify an "output format"
  490. when you print a value.
  491.  
  492.    The simplest use of output formats is to say how to print a value
  493. already computed.  This is done by starting the arguments of the
  494. `print' command with a slash and a format letter.  The format
  495. letters supported are:
  496.  
  497. `x'
  498.      Regard the bits of the value as an integer, and print the
  499.      integer in hexadecimal.
  500.  
  501. `d'
  502.      Print as integer in signed decimal.
  503.  
  504. `u'
  505.      Print as integer in unsigned decimal.
  506.  
  507. `o'
  508.      Print as integer in octal.
  509.  
  510. `t'
  511.      Print as integer in binary.  The letter `t' stands for "two".
  512.  
  513. `a'
  514.      Print as an address, both absolute in hex and as an offset from
  515.      the nearest preceding symbol.  This format can be used to
  516.      discover where (in what function) an unknown address is located:
  517.  
  518.           (gdb) p/a 0x54320
  519.           $3 = 0x54320 <_initialize_vx+396>
  520.  
  521. `c'
  522.      Regard as an integer and print it as a character constant.
  523.  
  524. `f'
  525.      Regard the bits of the value as a floating point number and
  526.      print
  527.      using typical floating point syntax.
  528.  
  529.    For example, to print the program counter in hex (*note
  530. Registers::.), type
  531.  
  532.      p/x $pc
  533.  
  534. Note that no space is required before the slash; this is because
  535. command names in GDB cannot contain a slash.
  536.  
  537.    To reprint the last value in the value history with a different
  538. format, you can use the `print' command with just a format and no
  539. expression.  For example, `p/x' reprints the last value in hex.
  540.  
  541. 
  542. File: gdb.info,  Node: Memory,  Next: Auto Display,  Prev: Output formats,  Up: Data
  543.  
  544. Examining Memory
  545. ================
  546.  
  547. `x/NFU ADDR'
  548. `x ADDR'
  549. `x'
  550.      You can use the command `x' (for `examine') to examine memory in
  551.      any of several formats, independently of your program's data
  552.      types.  N, F, and U are all optional parameters to specify how
  553.      much memory to display, and how to format it; ADDR is an
  554.      expression giving the address where you want to start
  555.      displaying memory.  If you use defaults for NFU, you need not
  556.      type the slash `/'.  Several commands set convenient defaults
  557.      for ADDR.
  558.  
  559.    N, the repeat count, is a decimal integer; the default is 1.  It
  560. specifies how much memory (counting by units U) to display.
  561.  
  562.    F, the display format, is one of the formats used by `print', or
  563. `s' (null-terminated string) or `i' (machine instruction).  The
  564. default is `x' (hexadecimal) initially, or the format from the last
  565. time you used either `x' or `print'.
  566.  
  567.    U, the unit size, is any of
  568.  
  569. `b'
  570.      Bytes.
  571.  
  572. `h'
  573.      Halfwords (two bytes).
  574.  
  575. `w'
  576.      Words (four bytes).  This is the initial default.
  577.  
  578. `g'
  579.      Giant words (eight bytes).
  580.  
  581. Each time you specify a unit size with `x', that size becomes the
  582. default unit the next time you use `x'.  (For the `s' and `i'
  583. formats, the unit size is ignored and is normally not written.)
  584.  
  585.    ADDR is the address where you want GDB to begin displaying memory.
  586. The expression need not have a pointer value (though it may); it is
  587. always interpreted as an integer address of a byte of memory.  *Note
  588. Expressions:: for more information on expressions.  The default for
  589. ADDR is usually just after the last address examined--but several
  590. other commands also set the default address: `info breakpoints' (to
  591. the address of the last breakpoint listed), `info line' (to the
  592. starting address of a line), and `print' (if you use it to display a
  593. value from memory).
  594.  
  595.    For example, `x/3uh 0x54320' is a request to display three
  596. halfwords (`h') of memory, formatted as unsigned decimal integers
  597. (`u'), starting at address `0x54320'.  `x/4xw $sp' prints the four
  598. words (`w') of memory above the stack pointer (here, `$sp'; *note
  599. Registers::.) in hexadecimal (`x').
  600.  
  601.    Since the letters indicating unit sizes are all distinct from the
  602. letters specifying output formats, you don't have to remember
  603. whether unit size or format comes first; either order will work. 
  604. The output specifications `4xw' and `4wx' mean exactly the same thing.
  605. (However, the count N must come first; `wx4' will not work.)
  606.  
  607.    Even though the unit size U is ignored for the formats `s' and
  608. `i', you might still want to use a count N; for example, `3i'
  609. specifies that you want to see three machine instructions, including
  610. any operands.  The command `disassemble' gives an alternative way of
  611. inspecting
  612. machine instructions; *note Machine Code::..
  613.  
  614.    All the defaults for the arguments to `x' are designed to make it
  615. easy to continue scanning memory with minimal specifications each
  616. time you use `x'.  For example, after you've inspected three machine
  617. instructions with `x/3i ADDR', you can inspect the next seven with
  618. just `x/7'.  If you use RET to repeat the `x' command, the repeat
  619. count N is used again; the other arguments default as for successive
  620. uses of `x'.
  621.  
  622.    The addresses and contents printed by the `x' command are not
  623. saved in the value history because there is often too much of them
  624. and they would get in the way.  Instead, GDB makes these values
  625. available for subsequent use in expressions as values of the
  626. convenience variables `$_' and `$__'.  After an `x' command, the
  627. last address examined is available for use in expressions in the
  628. convenience variable `$_'.  The contents of that address, as
  629. examined, are available in the convenience variable `$__'.
  630.  
  631.    If the `x' command has a repeat count, the address and contents
  632. saved are from the last memory unit printed; this is not the same as
  633. the last address printed if several units were printed on the last
  634. line of output.
  635.  
  636. 
  637. File: gdb.info,  Node: Auto Display,  Next: Print Settings,  Prev: Memory,  Up: Data
  638.  
  639. Automatic Display
  640. =================
  641.  
  642.    If you find that you want to print the value of an expression
  643. frequently (to see how it changes), you might want to add it to the
  644. "automatic
  645. display list" so that GDB will print its value each time the program
  646. stops.  Each expression added to the list is given a number to
  647. identify it; to remove an expression from the list, you specify that
  648. number.  The automatic display looks like this:
  649.  
  650.      2: foo = 38
  651.      3: bar[5] = (struct hack *) 0x3804
  652.  
  653. showing item numbers, expressions and their current values.  As with
  654. displays you request manually using `x' or `print', you can specify
  655. the output format you prefer; in fact, `display' decides whether to
  656. use `print' or `x' depending on how elaborate your format
  657. specification
  658. is--it uses `x' if you specify a unit size, or one of the two
  659. formats (`i' and `s') that are only supported by `x'; otherwise it
  660. uses `print'.
  661.  
  662. `display EXP'
  663.      Add the expression EXP to the list of expressions to display
  664.      each time the program stops.  *Note Expressions::.
  665.  
  666.      `display' will not repeat if you press RET again after using it.
  667.  
  668. `display/FMT EXP'
  669.      For FMT specifying only a display format and not a size or
  670.      count, add the expression EXP to the auto-display list but
  671.      arranges to display it each time in the specified format FMT. 
  672.      *Note Output formats::.
  673.  
  674. `display/FMT ADDR'
  675.      For FMT `i' or `s', or including a unit-size or a number of
  676.      units, add the expression ADDR as a memory address to be
  677.      examined each time the program stops.  Examining means in
  678.      effect doing `x/FMT ADDR'.  *Note Memory::.
  679.  
  680.    For example, `display/i $pc' can be helpful, to see the machine
  681. instruction about to be executed each time execution stops (`$pc' is
  682. a common name for the program counter; *note Registers::.).
  683.  
  684. `undisplay DNUMS...'
  685. `delete display DNUMS...'
  686.      Remove item numbers DNUMS from the list of expressions to display.
  687.  
  688.      `undisplay' will not repeat if you press RET after using it. 
  689.      (Otherwise you would just get the error `No display number ...'.)
  690.  
  691. `disable display DNUMS...'
  692.      Disable the display of item numbers DNUMS.  A disabled display
  693.      item is not printed automatically, but is not forgotten.  It
  694.      may be enabled again later.
  695.  
  696. `enable display DNUMS...'
  697.      Enable display of item numbers DNUMS.  It becomes effective once
  698.      again in auto display of its expression, until you specify
  699.      otherwise.
  700.  
  701. `display'
  702.      Display the current values of the expressions on the list, just
  703.      as is done when the program stops.
  704.  
  705. `info display'
  706.      Print the list of expressions previously set up to display
  707.      automatically, each one with its item number, but without
  708.      showing the values.  This includes disabled expressions, which
  709.      are marked as such.  It also includes expressions which would
  710.      not be displayed right now because they refer to automatic
  711.      variables not currently available.
  712.  
  713.    If a display expression refers to local variables, then it does
  714. not make sense outside the lexical context for which it was set up. 
  715. Such an expression is disabled when execution enters a context where
  716. one of its variables is not defined.  For example, if you give the
  717. command `display last_char' while inside a function with an argument
  718. `last_char', then this argument will be displayed while the program
  719. continues to stop inside that function.  When it stops
  720. elsewhere--where there is no variable `last_char'--display is
  721. disabled.  The next time your program stops where `last_char' is
  722. meaningful, you can enable the display expression once again.
  723.  
  724. 
  725. File: gdb.info,  Node: Print Settings,  Next: Value History,  Prev: Auto Display,  Up: Data
  726.  
  727. Print Settings
  728. ==============
  729.  
  730.    GDB provides the following ways to control how arrays, structures,
  731. and symbols are printed.
  732.  
  733. These settings are useful for debugging programs in any language:
  734.  
  735. `set print address'
  736. `set print address on'
  737.      GDB will print memory addresses showing the location of stack
  738.      traces, structure values, pointer values, breakpoints, and so
  739.      forth, even when it also displays the contents of those
  740.      addresses.  The default is on.  For example, this is what a
  741.      stack frame display looks like, with `set print address on':
  742.  
  743.           (gdb) f
  744.           #0  set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>")
  745.               at input.c:530
  746.           530         if (lquote != def_lquote)
  747.  
  748. `set print address off'
  749.      Do not print addresses when displaying their contents.  For
  750.      example, this is the same stack frame displayed with `set print
  751.      address off':
  752.  
  753.           (gdb) set print addr off
  754.           (gdb) f
  755.           #0  set_quotes (lq="<<", rq=">>") at input.c:530
  756.           530         if (lquote != def_lquote)
  757.  
  758. `show print address'
  759.      Show whether or not addresses are to be printed.
  760.  
  761. `set print array'
  762. `set print array on'
  763.      GDB will pretty print arrays.  This format is more convenient to
  764.      read, but uses more space.  The default is off.
  765.  
  766. `set print array off.'
  767.      Return to compressed format for arrays.
  768.  
  769. `show print array'
  770.      Show whether compressed or pretty format is selected for
  771.      displaying arrays.
  772.  
  773. `set print elements NUMBER-OF-ELEMENTS'
  774.      If GDB is printing a large array, it will stop printing after it
  775.      has printed the number of elements set by the `set print
  776.      elements' command.  This limit also applies to the display of
  777.      strings.
  778.  
  779. `show print elements'
  780.      Display the number of elements of a large array that GDB will
  781.      print before losing patience.
  782.  
  783. `set print pretty on'
  784.      Cause GDB to print structures in an indented format with one
  785.      member per line, like this:
  786.  
  787.           $1 = {
  788.             next = 0x0,
  789.             flags = {
  790.               sweet = 1,
  791.               sour = 1
  792.             },
  793.             meat = 0x54 "Pork"
  794.           }
  795.  
  796. `set print pretty off'
  797.      Cause GDB to print structures in a compact format, like this:
  798.  
  799.           $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, meat \
  800.           = 0x54 "Pork"}
  801.  
  802.      This is the default format.
  803.  
  804. `show print pretty'
  805.      Show which format GDB will use to print structures.
  806.  
  807. `set print sevenbit-strings on'
  808.      Print using only seven-bit characters; if this option is set,
  809.      GDB will display any eight-bit characters (in strings or
  810.      character values) using the notation `\'NNN.  For example,
  811.      `M-a' is displayed as `\341'.
  812.  
  813. `set print sevenbit-strings off'
  814.      Print using either seven-bit or eight-bit characters, as
  815.      required.  This is the default.
  816.  
  817. `show print sevenbit-strings'
  818.      Show whether or not GDB will print only seven-bit characters.
  819.  
  820. `set print union on'
  821.      Tell GDB to print unions which are contained in structures. 
  822.      This is the default setting.
  823.  
  824. `set print union off'
  825.      Tell GDB not to print unions which are contained in structures.
  826.  
  827. `show print union'
  828.      Ask GDB whether or not it will print unions which are contained
  829.      in structures.
  830.  
  831.      For example, given the declarations
  832.  
  833.           typedef enum {Tree, Bug} Species;
  834.           typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
  835.           typedef enum {Caterpillar, Cocoon, Butterfly} Bug_forms;
  836.           
  837.           struct thing {
  838.             Species it;
  839.             union {
  840.               Tree_forms tree;
  841.               Bug_forms bug;
  842.             } form;
  843.           };
  844.           
  845.           struct thing foo = {Tree, {Acorn}};
  846.  
  847.      with `set print union on' in effect `p foo' would print
  848.  
  849.           $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}}
  850.  
  851.      and with `set print union off' in effect it would print
  852.  
  853.           $1 = {it = Tree, form = {...}}
  854.  
  855. These settings are of interest when debugging C++ programs:
  856.  
  857. `set print demangle'
  858. `set print demangle on'
  859.      Print C++ names in their source form rather than in the mangled
  860.      form in which they are passed to the assembler and linker for
  861.      type-safe linkage.  The default is on.
  862.  
  863. `show print demangle'
  864.      Show whether C++ names will be printed in mangled or demangled
  865.      form.
  866.  
  867. `set print asm-demangle'
  868. `set print asm-demangle on'
  869.      Print C++ names in their source form rather than their mangled
  870.      form, even in assembler code printouts such as instruction
  871.      disassemblies.  The default is off.
  872.  
  873. `show print asm-demangle'
  874.      Show whether C++ names in assembly listings will be printed in
  875.      mangled or demangled form.
  876.  
  877. `set print object'
  878. `set print object on'
  879.      When displaying a pointer to an object, identify the *actual*
  880.      (derived) type of the object rather than the *declared* type,
  881.      using the virtual function table.
  882.  
  883. `set print object off'
  884.      Display only the declared type of objects, without reference to
  885.      the virtual function table.  This is the default setting.
  886.  
  887. `show print object'
  888.      Show whether actual, or declared, object types will be displayed.
  889.  
  890. `set print vtbl'
  891. `set print vtbl on'
  892.      Pretty print C++ virtual function tables.  The default is off.
  893.  
  894. `set print vtbl off'
  895.      Do not pretty print C++ virtual function tables.
  896.  
  897. `show print vtbl'
  898.      Show whether C++ virtual function tables are pretty printed, or
  899.      not.
  900.  
  901. 
  902. File: gdb.info,  Node: Value History,  Next: Convenience Vars,  Prev: Print Settings,  Up: Data
  903.  
  904. Value History
  905. =============
  906.  
  907.    Values printed by the `print' command are saved in GDB's "value
  908. history" so that you can refer to them in other expressions.  Values
  909. are kept until the symbol table is re-read or discarded (for example
  910. with the `file' or `symbol-file' commands).  When the symbol table
  911. changes, the value history is discarded, since the values may
  912. contain pointers back to the types defined in the symbol table.
  913.  
  914.    The values printed are given "history numbers" for you to refer to
  915. them by.  These are successive integers starting with one.  `print'
  916. shows you the history number assigned to a value by printing `$NUM =
  917. ' before the value; here NUM is the history number.
  918.  
  919.    To refer to any previous value, use `$' followed by the value's
  920. history number.  The way `print' labels its output is designed to
  921. remind
  922. you of this.  Just `$' refers to the most recent value in the
  923. history, and `$$' refers to the value before that.  `$$N' refers to
  924. the Nth value from the end; `$$2' is the value just prior to `$$',
  925. `$$1' is equivalent to `$$', and `$$0' is equivalent to `$'.
  926.  
  927.    For example, suppose you have just printed a pointer to a
  928. structure and want to see the contents of the structure.  It
  929. suffices to type
  930.  
  931.      p *$
  932.  
  933.    If you have a chain of structures where the component `next'
  934. points to the next one, you can print the contents of the next one
  935. with this:
  936.  
  937.      p *$.next
  938.  
  939. You can print successive links in the chain by repeating this
  940. command--which you can do by just typing RET.
  941.  
  942.    Note that the history records values, not expressions.  If the
  943. value of `x' is 4 and you type these commands:
  944.  
  945.      print x
  946.      set x=5
  947.  
  948. then the value recorded in the value history by the `print' command
  949. remains 4 even though the value of `x' has changed.
  950.  
  951. `show values'
  952.      Print the last ten values in the value history, with their item
  953.      numbers.  This is like `p $$9' repeated ten times, except that
  954.      `show values' does not change the history.
  955.  
  956. `show values N'
  957.      Print ten history values centered on history item number N.
  958.  
  959. `show values +'
  960.      Print ten history values just after the values last printed.  If
  961.      no more values are available, produces no display.
  962.  
  963.    Pressing RET to repeat `show values N' has exactly the same effect
  964. as `show values +'.
  965.  
  966. 
  967. File: gdb.info,  Node: Convenience Vars,  Next: Registers,  Prev: Value History,  Up: Data
  968.  
  969. Convenience Variables
  970. =====================
  971.  
  972.    GDB provides "convenience variables" that you can use within GDB
  973. to hold on to a value and refer to it later.  These variables exist
  974. entirely within GDB; they are not part of your program, and setting
  975. a convenience variable has no direct effect on further execution of
  976. your program.  That's why you can use them freely.
  977.  
  978.    Convenience variables are prefixed with `$'.  Any name preceded by
  979. `$' can be used for a convenience variable, unless it is one of the
  980. predefined machine-specific register names (*note Registers::.). 
  981. (Value history references, in contrast, are *numbers* preceded by
  982. `$'.  *Note Value History::.)
  983.  
  984.    You can save a value in a convenience variable with an assignment
  985. expression, just as you would set a variable in your program. 
  986. Example:
  987.  
  988.      set $foo = *object_ptr
  989.  
  990. would save in `$foo' the value contained in the object pointed to by
  991. `object_ptr'.
  992.  
  993.    Using a convenience variable for the first time creates it; but
  994. its value is `void' until you assign a new value.  You can alter the
  995. value with another assignment at any time.
  996.  
  997.    Convenience variables have no fixed types.  You can assign a
  998. convenience variable any type of value, including structures and
  999. arrays, even if that variable already has a value of a different
  1000. type.  The convenience variable, when used as an expression, has the
  1001. type of its current value.
  1002.  
  1003. `show convenience'
  1004.      Print a list of convenience variables used so far, and their
  1005.      values.  Abbreviated `show con'.
  1006.  
  1007.    One of the ways to use a convenience variable is as a counter to
  1008. be incremented or a pointer to be advanced.  For example, to print a
  1009. field from successive elements of an array of structures:
  1010.  
  1011.      set $i = 0
  1012.      print bar[$i++]->contents
  1013.      ... repeat that command by typing RET.
  1014.  
  1015.    Some convenience variables are created automatically by GDB and
  1016. given values likely to be useful.
  1017.  
  1018. `$_'
  1019.      The variable `$_' is automatically set by the `x' command to the
  1020.      last address examined (*note Memory::.).  Other commands which
  1021.      provide a default address for `x' to examine also set `$_' to
  1022.      that address; these commands include `info line' and `info
  1023.      breakpoint'.  The type of `$_' is `void *' except when set by
  1024.      the `x' command, in which case it is a pointer to the type of
  1025.     
  1026.      `$__'.
  1027.  
  1028. `$__'
  1029.      The variable `$__' is automatically set by the `x' command to
  1030.      the value found in the last address examined.  Its type is
  1031.      chosen to match the format in which the data was printed.
  1032.  
  1033. 
  1034. File: gdb.info,  Node: Registers,  Next: Floating Point Hardware,  Prev: Convenience Vars,  Up: Data
  1035.  
  1036. Registers
  1037. =========
  1038.  
  1039.    You can refer to machine register contents, in expressions, as
  1040. variables with names starting with `$'.  The names of registers are
  1041. different for each machine; use `info registers' to see the names
  1042. used
  1043. on your machine.
  1044.  
  1045. `info registers'
  1046.      Print the names and values of all registers except
  1047.      floating-point registers (in the selected stack frame).
  1048.  
  1049. `info all-registers'
  1050.      Print the names and values of all registers, including
  1051.      floating-point registers.
  1052.  
  1053. `info registers REGNAME'
  1054.      Print the relativized value of register REGNAME.  REGNAME may be
  1055.      any register name valid on the machine you are using, with or
  1056.      without the initial `$'.
  1057.  
  1058.    GDB has four "standard" register names that are available (in
  1059. expressions) on most machines--whenever they don't conflict with an
  1060. architecture's canonical mnemonics for registers.  The register
  1061. names `$pc' and `$sp' are used for the program counter register and
  1062. the stack pointer.  `$fp' is used for a register that contains a
  1063. pointer
  1064. to the current stack frame, and `$ps' is used for a register that
  1065. contains the processor status.  For example, you could print the
  1066. program counter in hex with
  1067.  
  1068.      p/x $pc
  1069.  
  1070. or print the instruction to be executed next with
  1071.  
  1072.      x/i $pc
  1073.  
  1074. or add four to the stack pointer (1) with
  1075.  
  1076.      set $sp += 4
  1077.  
  1078.    Whenever possible, these four standard register names are
  1079. available on your machine even though the machine has different
  1080. canonical mnemonics, so long as there is no conflict.  The `info
  1081. registers' command shows the canonical names.  For example, on the
  1082. SPARC, `info registers' displays the processor status register as
  1083. `$psr' but you can also refer to it as `$ps'.
  1084.  
  1085.    GDB always considers the contents of an ordinary register as an
  1086. integer when the register is examined in this way.  Some machines
  1087. have special registers which can hold nothing but floating point;
  1088. these registers are considered to have floating point values.  There
  1089. is no way to refer to the contents of an ordinary register as
  1090. floating point value (although you can *print* it as a floating
  1091. point value with `print/f $REGNAME').
  1092.  
  1093.    Some registers have distinct "raw" and "virtual" data formats. 
  1094. This means that the data format in which the register contents are
  1095. saved by the operating system is not the same one that your program
  1096. normally sees.  For example, the registers of the 68881 floating
  1097. point coprocessor are always saved in "extended" (raw) format, but
  1098. all C programs expect to work with "double" (virtual) format.  In
  1099. such cases, GDB normally works with the virtual format only (the
  1100. format that makes sense for your program), but the `info registers'
  1101. command prints the data in both formats.
  1102.  
  1103.    Normally, register values are relative to the selected stack frame
  1104. (*note Selection::.).  This means that you get the value that the
  1105. register would contain if all stack frames farther in were exited
  1106. and their saved registers restored.  In order to see the true
  1107. contents of hardware registers, you must select the innermost frame
  1108. (with `frame 0').
  1109.  
  1110.    However, GDB must deduce where registers are saved, from the
  1111. machine code generated by your compiler.  If some registers are not
  1112. saved, or if GDB is unable to locate the saved registers, the
  1113. selected stack frame will make no difference.
  1114.  
  1115.    ---------- Footnotes ----------
  1116.  
  1117.    (1)  This is a way of removing one word from the stack, on
  1118. machines where stacks grow downward in memory (most machines,
  1119. nowadays).  This assumes that the innermost stack frame is selected;
  1120. setting `$sp' is not allowed when other stack frames are selected. 
  1121. To
  1122. pop entire frames off the stack, regardless of machine architecture,
  1123. use `return'; *note Returning::..
  1124.  
  1125. 
  1126. File: gdb.info,  Node: Floating Point Hardware,  Prev: Registers,  Up: Data
  1127.  
  1128. Floating Point Hardware
  1129. =======================
  1130.  
  1131.    Depending on the host machine architecture, GDB may be able to
  1132. give you more information about the status of the floating point
  1133. hardware.
  1134.  
  1135. `info float'
  1136.      If available, provides hardware-dependent information about the
  1137.      floating point unit.  The exact contents and layout vary
  1138.      depending on the floating point chip.
  1139.  
  1140. 
  1141. File: gdb.info,  Node: Languages,  Next: Symbols,  Prev: Data,  Up: Top
  1142.  
  1143. Using GDB with Different Languages
  1144. **********************************
  1145.  
  1146.    Although programming languages generally have common aspects, they
  1147. are rarely expressed in the same manner.  For instance, in ANSI C,
  1148. dereferencing a pointer `p' is accomplished by `*p', but in
  1149. Modula-2, it is accomplished by `p^'.  Values can also be
  1150. represented (and displayed) differently.  Hex numbers in C are
  1151. written like `0x1ae', while in Modula-2 they appear as `1AEH'.
  1152.  
  1153.    Language-specific information is built into GDB for some
  1154. languages, allowing you to express operations like the above in the
  1155. program's native language, and allowing GDB to output values in a
  1156. manner consistent with the syntax of the program's native language. 
  1157. The language you use to build expressions, called the "working
  1158. language", can be selected manually, or GDB can set it automatically.
  1159.  
  1160. * Menu:
  1161.  
  1162. * Setting::                     Switching between source languages
  1163. * Show::                        Displaying the language
  1164. * Checks::                      Type and Range checks
  1165. * Support::                     Supported languages
  1166.  
  1167. 
  1168. File: gdb.info,  Node: Setting,  Next: Show,  Prev: Languages,  Up: Languages
  1169.  
  1170. Switching between source languages
  1171. ==================================
  1172.  
  1173.    There are two ways to control the working language--either have
  1174. GDB set it automatically, or select it manually yourself.  You can
  1175. use the `set language' command for either purpose.  On startup, GDB
  1176. defaults to setting the language automatically.
  1177.  
  1178. * Menu:
  1179.  
  1180. * Manually::                    Setting the working language manually
  1181. * Automatically::               Having GDB infer the source language
  1182.  
  1183. 
  1184. File: gdb.info,  Node: Manually,  Next: Automatically,  Prev: Setting,  Up: Setting
  1185.  
  1186. Setting the working language
  1187. ----------------------------
  1188.  
  1189.    To set the language, issue the command `set language LANG', where
  1190. LANG is the name of a language: `c' or `modula-2'.  For a list of
  1191. the supported languages, type `set language'.
  1192.  
  1193.    Setting the language manually prevents GDB from updating the
  1194. working language automatically.  This can lead to confusion if you
  1195. try to debug a program when the working language is not the same as
  1196. the
  1197. source language, when an expression is acceptable to both
  1198. languages--but means different things.  For instance, if the current
  1199. source file were written in C, and GDB was parsing Modula-2, a
  1200. command such as:
  1201.  
  1202.      print a = b + c
  1203.  
  1204. might not have the effect you intended.  In C, this means to add `b'
  1205. and `c' and place the result in `a'.  The result printed would be
  1206. the value of `a'.  In Modula-2, this means to compare `a' to the
  1207. result of `b+c', yielding a `BOOLEAN' value.
  1208.  
  1209.    If you allow GDB to set the language automatically, then you can
  1210. count on expressions evaluating the same way in your debugging
  1211. session and in your program.
  1212.  
  1213. 
  1214. File: gdb.info,  Node: Automatically,  Prev: Manually,  Up: Setting
  1215.  
  1216. Having GDB infer the source language
  1217. ------------------------------------
  1218.  
  1219.    To have GDB set the working language automatically, use `set
  1220. language local' or `set language auto'.  GDB then infers the
  1221. language that a program was written in by looking at the name of its
  1222. source files, and examining their extensions:
  1223.  
  1224. `*.mod'
  1225.      Modula-2 source file
  1226.  
  1227. `*.c'
  1228. `*.cc'
  1229.      C or C++ source file.
  1230.  
  1231.    This information is recorded for each function or procedure in a
  1232. source file.  When your program stops in a frame (usually by
  1233. encountering a breakpoint), GDB sets the working language to the
  1234. language recorded for the function in that frame.  If the language
  1235. for a frame is unknown (that is, if the function or block
  1236. corresponding to the frame was defined in a source file that does
  1237. not have a recognized extension), the current working language is
  1238. not changed, and GDB issues a warning.
  1239.  
  1240.    This may not seem necessary for most programs, which are written
  1241. entirely in one source language.  However, program modules and
  1242. libraries written in one source language can be used by a main
  1243. program written in a different source language.  Using `set language
  1244. auto' in this case frees you from having to set the working language
  1245. manually.
  1246.  
  1247. 
  1248. File: gdb.info,  Node: Show,  Next: Checks,  Prev: Setting,  Up: Languages
  1249.  
  1250. Displaying the language
  1251. =======================
  1252.  
  1253.    The following commands will help you find out which language is
  1254. the working language, and also what language source files were
  1255. written in.
  1256.  
  1257. `show language'
  1258.      Display the current working language.  This is the language you
  1259.      can use with commands such as `print' to build and compute
  1260.      expressions that may involve variables in the program.
  1261.  
  1262. `info frame'
  1263.      Among the other information listed here (*note Information about
  1264.      a Frame: Frame Info.) is the source language for this frame. 
  1265.      This is the language that will become the working language if
  1266.      you ever use an identifier that is in this frame.
  1267.  
  1268. `info source'
  1269.      Among the other information listed here (*note Examining the
  1270.      Symbol Table: Symbols.) is the source language of this source
  1271.      file.
  1272.  
  1273. 
  1274. File: gdb.info,  Node: Checks,  Next: Support,  Prev: Show,  Up: Languages
  1275.  
  1276. Type and range Checking
  1277. =======================
  1278.  
  1279.      *Warning:* In this release, the GDB commands for type and range
  1280.     
  1281.      checking are included, but they do not yet have any effect. 
  1282.      This section documents the intended facilities.
  1283.  
  1284.    Some languages are designed to guard you against making seemingly
  1285. common errors through a series of compile- and run-time checks. 
  1286. These
  1287. include checking the type of arguments to functions and operators,
  1288. and making sure mathematical overflows are caught at run time. 
  1289. Checks such as these help to ensure a program's correctness once it
  1290. has
  1291. been compiled by eliminating type mismatches, and providing active
  1292. checks for range errors when the program is running.
  1293.  
  1294.    GDB can check for conditions like the above if you wish.  Although
  1295. GDB will not check the statements in your program, it can check
  1296. expressions entered directly into GDB for evaluation via the `print'
  1297. command, for example.  As with the working language, GDB can also
  1298. decide whether or not to check automatically based on the source
  1299. language of the program being debugged.  *Note Supported Languages:
  1300. Support, for the default settings of supported languages.
  1301.  
  1302. * Menu:
  1303.  
  1304. * Type Checking::               An overview of type checking
  1305. * Range Checking::              An overview of range checking
  1306.  
  1307.